:root {
    --amily2-bg-color: #2C2C2C;
    --amily2-button-color: #4A4A4A;
    --amily2-text-color: #E0E0E0;
}

.manual-command-block {
    flex-wrap: wrap; 
    justify-content: space-between; 
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}


.manual-command-block .manual-input {
    flex: 1 1 60px; 
    width: 80px;
    padding: 6px;
    text-align: center;
    border: 1px solid var(--border_color);
    background-color: var(--amily2-bg-color);
    color: var(--amily2-text-color);
    border-radius: 5px;
}

.manual-command-block .menu_button {
    flex: 2 1 90px; 
    flex-grow: 1;
    margin: 0;
}

.manual-command-block label {
    flex-shrink: 0;
    margin-right: 5px;
}

.manual-command-block .manual-command-divider {
    font-weight: bold;
    color: var(--amily2-text-color);
}

#amily2_manual_historiography_bureau .mhb-controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 12px;
    margin-top: 5px;
}


#amily2_manual_historiography_bureau .manual-command-block {
    flex-wrap: wrap;
    gap: 5px; /* 减小间距以适应换行 */
}
#amily2_manual_historiography_bureau .manual-command-block .manual-input {
    flex: 1 1 50px; /* 弹性伸缩 */
}
#amily2_manual_historiography_bureau .manual-command-block .menu_button {
    flex: 2 1 80px; /* 按钮占据更多空间 */
}


#amily2_manual_historiography_bureau .editor-buttons-panel .accent {
    background: linear-gradient(to right, #FF5722, #E64A19);
    border: 1px solid #D84315;
}
#amily2_manual_historiography_bureau .editor-buttons-panel .accent:hover {
    box-shadow: 0 0 8px rgba(255, 87, 34, 0.7);
    transform: scale(1.03);
}
#amily2_manual_historiography_bureau .editor-buttons-panel .secondary {
    background: linear-gradient(to right, #ffb300, #fb8c00);
    border: 1px solid #f57c00;
}
#amily2_manual_historiography_bureau .editor-buttons-panel .secondary:hover {
    box-shadow: 0 0 8px rgba(255, 179, 0, 0.7);
    transform: scale(1.03);
}


#amily2_manual_historiography_bureau .mhb-selector-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}


#amily2_manual_historiography_bureau .mhb-selector-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
    gap: 5px;
}
#amily2_manual_historiography_bureau .mhb-selector-group > label {
    width: auto;
    margin-top: 0;
}


#amily2_manual_historiography_bureau .auto-command-block {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap; /* 允许换行 */
    gap: 15px;
    margin-top: 15px;
    padding: 10px;
    border: 1px solid var(--secondary-border);
    border-radius: 8px;
}


#amily2_manual_historiography_bureau .auto-control-pair {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
#amily2_manual_historiography_bureau #amily2_mhb_small_expedition_execute {
    width: auto;  
    flex-grow: 0; 
}
#amily2_manual_historiography_bureau #amily2_mhb_small_expedition_execute {
    background: linear-gradient(135deg, #8e44ad, #6a1b9a); 
    border: 1px solid #4a148c;
    color: white; 
    text-shadow: 0 0 2px rgba(0,0,0,0.3); 
    transition: all 0.3s ease; 
}

#amily2_manual_historiography_bureau #amily2_mhb_small_expedition_execute:hover {
    background: linear-gradient(135deg, #9b59b6, #8e44ad); 
    box-shadow: 0 0 10px rgba(142, 68, 173, 0.7);
    transform: translateY(-1px);
}


#amily2_manual_historiography_bureau #amily2_mhb_small_manual_execute {
    background: linear-gradient(135deg, #ff8a65, #ff5722);
    border: 1px solid #e64a19;
}

#amily2_manual_historiography_bureau #amily2_mhb_small_manual_execute:hover {
    background: linear-gradient(135deg, #ff7043, #f4511e);
    box-shadow: 0 0 10px rgba(255, 87, 34, 0.6);
}

#amily2_manual_historiography_bureau .danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 1px solid #a93226;
    color: white;
}

#amily2_manual_historiography_bureau .danger:hover {
    background: linear-gradient(135deg, #ec7063, #e74c3c);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.7);
}

#amily2_manual_historiography_bureau .success {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

#amily2_manual_historiography_bureau .success:hover {
    background: linear-gradient(135deg, #58d68d, #2ecc71);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.7);
}

.prompt-editor-area {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
}
.prompt-editor-area textarea {
    flex-grow: 1;
    resize: vertical;
}

.editor-buttons-panel {
    display: flex;
    flex-direction: row;
    gap: 10px;
}
.editor-buttons-panel .menu_button {
    margin: 0;
}

.editor_maximize {
    color: #ccc;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}
.editor_maximize:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.label-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#amily2_unhide_all_button {
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: linear-gradient(135deg, #28a745, #20c997);
    border: 1px solid #198754;
    color: white;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border-radius: 8px;
}

#amily2_unhide_all_button:hover {
    background: linear-gradient(135deg, #20c997, #28a745);
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.7);
    transform: translateY(-2px);
    border-color: #1a9c5c;
}

#amily2_unhide_all_button {
    font-size: 13px;
    line-height: 1.2;
}

#amily2_unhide_all_button i {
    font-size: 16px;
    margin: 0;
}
#amily2_unhide_all_button span {
    font-size: 9px;
    font-weight: normal;
}

.amily2-panel-visible {
    display: flex !important;
    flex-direction: column;
    flex-grow: 1;
    gap: 15px;
}

.opt-exclusion-rule-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.opt-exclusion-rule-row input[type="text"] {
    flex-grow: 1;
}

.delete-rule-btn.danger_button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 1px solid #a93226;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 1;
    text-align: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s ease-in-out;
}

.delete-rule-btn.danger_button:hover {
    background: linear-gradient(135deg, #ec7063, #e74c3c);
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.7);
    transform: scale(1.05);
}

.amily2-add-rule-btn {
    width: auto;
    padding: 8px 16px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: 1px solid #229954;
    color: white;
    font-weight: bold;
}

.amily2-add-rule-btn:hover {
    background: linear-gradient(135deg, #58d68d, #2ecc71);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.7);
}

/* Styles moved from hanlinyuan.css that are required by the Historiographer panel */

.hly-control-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hly-imperial-brush {
    width: 100%;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid #555;
    border-radius: 8px;
    padding: 10px;
    color: #f0f0f0;
    transition: all 0.3s ease;
}
.hly-imperial-brush:focus {
    background-color: rgba(0, 0, 0, 0.5);
    border-color: #7e57c2;
    box-shadow: 0 0 10px rgba(126, 87, 194, 0.5);
    outline: none;
}

/* Combined rule for all toggle switches in this panel */
.toggle-switch,
.hly-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input,
.hly-toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-switch .slider,
.hly-toggle-switch .slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #333; border-radius: 26px; transition: .4s;
    border: 1px solid #555;
}
.toggle-switch .slider:before,
.hly-toggle-switch .slider:before {
    position: absolute; content: ""; height: 20px; width: 20px; left: 2px; bottom: 2px;
    background-color: white; border-radius: 50%; transition: .4s;
}
.toggle-switch input:checked + .slider,
.hly-toggle-switch input:checked + .slider {
    background: linear-gradient(to right, #7e57c2, #5e35b1);
    box-shadow: 0 0 8px rgba(126, 87, 194, 0.7);
}
.toggle-switch input:checked + .slider:before,
.hly-toggle-switch input:checked + .slider:before { transform: translateX(24px); }


.hly-action-button {
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    background-color: var(--amily2-button-color);
    color: var(--amily2-text-color);
    border-color: #666;
}
.hly-action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.hly-button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Ngms API 按钮样式 - 水平扁平按钮 */
.ngms-button-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.ngms-button-row .menu_button {
    min-width: 120px;
    height: 35px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.5px;
}

.ngms-button-row .menu_button.primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: 1px solid #388e3c;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.ngms-button-row .menu_button.primary:hover {
    background: linear-gradient(135deg, #5CBF60, #4CAF50);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    transform: translateY(-1px);
}

.ngms-button-row .menu_button.secondary {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border: 1px solid #1565C0;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.ngms-button-row .menu_button.secondary:hover {
    background: linear-gradient(135deg, #42A5F5, #2196F3);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    transform: translateY(-1px);
}

.ngms-button-row .menu_button i {
    font-size: 14px;
}
